package thinking_net;

import java.net.DatagramPacket;
import java.net.InetAddress;

public class Dgram {

	public static DatagramPacket toDatagram(String s,InetAddress destIA,int destPart){
		byte[] bytes=s.getBytes();
		return new DatagramPacket(bytes, bytes.length, destIA, destPart);		
	}
	
	public static String toString(DatagramPacket datagramPacket){
		return new String(datagramPacket.getData());
	}
	
}
